<template>
    <div id="TextGoldenGate" ref="TextGoldenGate" class="TextGoldenGate">
        <div class="textLable">
            <span style="color: rgb(255, 222, 51)">
                <p>
                    系统名称: <span style="color: rgb(229, 230, 250)">{{this.systemName}} </span>
                </p>
                <p>
                    数据库名: <span style="color: rgb(229, 230, 250)">{{this.instanceName}} </span>
                </p>
                <p>
                    GGS名称: <span style="color: rgb(229, 230, 250)">{{this.GGSName}} </span>
                </p>
                <p>
                    GGS进程: <span style="color: rgb(229, 230, 250)">{{this.GGSProcess}} </span>
                </p>
                <p>
                    GGS类型: <span style="color: rgb(229, 230, 250)">{{this.GGSType}} </span>
                </p>
                <p>
                    GGS状态: <span style="color: rgb(229, 230, 250)">{{this.GGSStatus}} </span>
                </p>
            </span>
        </div>
    </div>
</template>>

<script>
import { fetchData } from '@/api/index.js';
import bus from 'common/bus.js';

export default {
    data() {
        return {
            postData: {
                opera: 'goldenGate',
                curPage: 1,
                pageSize: 20,
                sort: {
                    sortColumn: '',
                    sortOrders: ''
                },
                filtersType: 'fuzzyquery',
                filters: {
                    "monid": "48C794177BA640E88C1269D0B6F361F8",
                },
            },
            systemName: '',
            instanceName: '',
            GGSName: '',
            GGSProcess: '',
            GGSType: '',
            GGSStatus: '',
            TextGoldenGate: {},
            timerName: 'TextGoldenGate',
            timerEventName: 'timerTextGoldenGate',
            timerInterval: 1000 * 60
        }
    },
    created() {
        this.getData();
        bus.$emit('timerNewTodo', {
            name: this.timerName,
            eventName: this.timerEventName,
            interval: this.timerInterval,
            intervalNow: 0
        });

        bus.$on(this.timerEventName, msg => {
            if (msg.isGetData) {
                this.getData();
            }
        });
    },
    mounted() {
        
    },
    computed: {
        postDataFn() {
            return {
                postData : JSON.stringify(this.postData)
            }
        }
    },
    methods: {
        getData(){
            fetchData(
                this.postDataFn
            ).then((res) => {
                this.systemName = res.data[0].SYSTEMNAME;
                this.instanceName = res.data[0].DB_SID;
                this.GGSName = res.data[0].GGS_NAME;
                this.GGSProcess = res.data[0].GGS_GROUP;
                this.GGSType = res.data[0].GGS_TYPE;
                this.GGSStatus = res.data[0].GGS_STATUS
            });
        }
    },
    beforeDestroy() {
        bus.$emit('timerNewTodo', {
            name: this.timerName
        });
    },
    watch:{
        
    }
}
</script>

<style scoped>
.TextGoldenGate{
    /* height: 150px; */
    /* border : 5px solid red */

}
.textLable{
    padding: 10px;
}
</style>